package org.data;

import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
import org.h2.jaqu.*;
import static org.h2.jaqu.Define.*;

public class SportsmanProfile implements Table, TableWithId {
    public Integer id;
    public String email;
    public String password;
    public String name;
    public String surname;
    public Timestamp birthday;
    public String club;
    public String qual;
    public String sex;
    public String trainer;
    public String city;
    public Integer deleted;

    public SportsmanProfile() {
        // public constructor
    }

    public SportsmanProfile(Integer id, String email, String password, String name, String surname, Timestamp birthday, String club, String qual, String sex, String trainer, String city) {
        this.id = id;
        this.email = email;
        this.password = password;
        this.name = name;
        this.surname = surname;
        this.birthday = birthday;
        this.club = club;
        this.qual = qual;
        this.sex = sex;
        this.trainer = trainer;
        this.city = city;
        this.deleted = 0;
    }
    
    public void define() {
        tableName("SportsmanProfile");
        primaryKey(id, email);   
    }

    // test
    private static SportsmanProfile create(Integer id, String email, String password, String name, String surname, Timestamp birthday, String club, String qual, String sex, String trainer, String city) {
        return new SportsmanProfile(id, email, password, name, surname, birthday, club, qual, sex, trainer, city);
    }

    // test method
    public static List<SportsmanProfile> getList() {
        SportsmanProfile[] list = new SportsmanProfile[] { 
                create(1, "mail1", "pass1", "name1", "surname1", new Timestamp(12345), "club1", "qual1", "H", "trainer1", "city1"),
                create(2, "mail2", "pass2", "name2", "surname2", new Timestamp(54321), "club2", "qual2", "D", "trainer2", "city2") 
        };
        return Arrays.asList(list);
    }
    
    @Override
    public String toString() {
        return name + " " + surname + " (" + club + ")";
    }

    public Integer getId() {
        return id;
    }

    public String getEmail() {
        return email;
    }

    public String getName() {
        return name;
    }

    public String getSurname() {
        return surname;
    }

    public String getClub() {
        return club;
    }
    
    public String getDeleted() {
        if (this.deleted != 1) {
            return "false";
        }
        return "true";
    }

}
